package dk.isten.andro.main;

import java.util.ArrayList;

import util.Item;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.ImageView;
import dk.isten.andro.R;


public class Ultras_Akt extends SuperActivity implements OnClickListener {
    /** Called when the activity is first created. */

   ImageView roed, horn,gul, imageView1;
   MediaPlayer enLyd;
   Item item;
   static ArrayList<util.Item> news = new ArrayList<util.Item>();
   WebView webview;

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ultrasakt);
        
        webview = (WebView) findViewById(R.id.sange);
        webview.getSettings().setJavaScriptEnabled(true);
        webview.loadUrl("file:///android_asset/sange.html");
        
        gul = (ImageView) findViewById(R.id.yellow);
        horn = (ImageView) findViewById(R.id.horn);
        roed = (ImageView) findViewById(R.id.red);
        imageView1 = (ImageView) findViewById(R.id.imageView1);
		
		imageView1.setOnClickListener(this);
        gul.setOnClickListener(this);
        horn.setOnClickListener(this);
        roed.setOnClickListener(this);

        
	}
	@Override
	public void onClick(View v) {

if(v==imageView1){
            
        	Intent i = new Intent(this, FrontActivity.class);
           
                    startActivity(i);
                    
        }else	if(v==gul){
                
                	Intent i = new Intent(this, yellow.class);
                   
                            startActivity(i);
                            
                }else if(v==roed){
                	Intent i = new Intent(this, red.class);
                    
                    		startActivity(i);
                }else if(v==horn){
                	
                    setVolumeControlStream(AudioManager.STREAM_MUSIC);
                    AudioManager audiomanager = (AudioManager) this.getSystemService(AUDIO_SERVICE);
                    //skru op for lyden
                    int  maxLydStyrke = audiomanager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); 

                    audiomanager.setStreamVolume(AudioManager.STREAM_MUSIC, maxLydStyrke, AudioManager.FLAG_SHOW_UI);
                    
                    
                	MediaPlayer enLyd = MediaPlayer.create(this, R.raw.vuvuzela);
                    enLyd.setVolume(9, 9);
                    enLyd.start();
        }
                }
	
}